$(function(){
    header.selLiCss("pro");

    var tagName = $("#menuName").text();
    //面包屑名称
    $("#menu-ico span").html(tagName);

    //点击下一张
    $('.arrow-r').on('click',function(){
        var moreProductDiv = $('.more-product-list');

        var productWidth = $('.more-product-list').outerWidth();
        //获取元素的宽度
        var itemWidth = $($(moreProductDiv).find('.recommend-product')[0]).innerWidth();
        var left = $(moreProductDiv).position().left;
        var num = Math.floor(-(left/itemWidth));//获取个数

        $(moreProductDiv).css('left',left-(productWidth/2)+'px');
        //判断显隐
        /*hideShowMore();*/
        $('.arrow-l').show();
        $('.arrow-r').hide();
    });
    //点击上一张
    $('.arrow-l').on('click',function(){
        var moreProductDiv = $('.more-product-list');
        //获取元素的宽度
        var productWidth = $('.more-product-list').outerWidth();
        var itemWidth = $($(moreProductDiv).find('.recommend-product')[0]).innerWidth();
        var left = $(moreProductDiv).position().left;
        var num = Math.floor(-(left/itemWidth));//获取个数
        $(moreProductDiv).css('left',left+(productWidth/2)+'px');
        //判断显隐
        $('.arrow-r').show();
        $('.arrow-l').hide();
    });


    function hideShowMore() {
        var moreProductDiv = $('.more-product-list');
        //获取元素的宽度
        var itemWidth = $($(moreProductDiv).find('.recommend-product')[0]).innerWidth();
        var left = $(moreProductDiv).position().left;
        if( left == 0 ){
            $('.arrow-l').hide();
            $('.arrow-r').show();
        }else{
            $('.arrow-l').show();
            $('.arrow-r').hide();
        }
        /*var num = Math.floor(-(left/itemWidth));//获取个数
        if( num == 3 ){
            $('.arrow-r').hide();
        }else{
            $('.arrow-r').show();
        }*/
    }

    hideShowMore();
});